import request from '@/utils/request'


// 获取单品满减活动列表
export function listDedicatedReduce (query) {
    return request({
        url: '/store/promotion/dedicatedReduce',
        method: 'get',
        params: query
    })
}
// 新增单品满减活动
export function addDedicatedReduce (data) {
    return request({
        url: '/store/promotion/dedicatedReduce',
        method: 'POST',
        data: data
    })
}
// 修改单品满减活动
export function updateDedicatedReduce (id, data) {
    return request({
        url: '/store/promotion/dedicatedReduce/' + id,
        method: 'put',
        data: data
    })
}

// 关闭 活动 
export function closeActivity (id) {
    return request({
        url: `/store/promotion/dedicatedReduce/${id}/close`,
        method: 'delete',
    })
}

//  获取单品满减活动规则列表
export function getGoodsActivityRuleList (promotionGoodsId) {
    return request({
        url: `/store/promotion/dedicatedReduce/${promotionGoodsId}/rules`,
        method: 'get',
    })
}

// 增加 
export function addGoodsActivityRule (freeShippingId, promotionGoodsId, data) {
    return request({
        url: `/store/promotion/dedicatedReduce/${freeShippingId}/${promotionGoodsId}/rules`,
        method: 'post',
        data: data,
    })
}

// 删除 
export function delGoodsActivityRule (dedicatedReduceId, promotionGoodsId, id) {
    return request({
        url: `/store/promotion/dedicatedReduce/${dedicatedReduceId}/${promotionGoodsId}/rules/${id}`,
        method: 'delete',
    })
}

// 修改 
export function updGoodsActivityRule (dedicatedReduceId, promotionGoodsId, id, data) {
    return request({
        url: `/store/promotion/dedicatedReduce/${dedicatedReduceId}/${promotionGoodsId}/rules/${id}`,
        method: 'put',
        data: data,
    })
}


